e[Single]
#ScriptVersion[2]
#Title[UR4]

script_enemy_main{
	
	@Initialize{
		//ACeύX
		point_num *= 20;
		spower_num = 0;
		lpower_num = 5;
		
		//wTCYύX
		magic_size = 0.75;
		
		//f[^
		InitializeData();
		Initialize_Fairy( LARGE_FLOWER );
		
		//摜ݒ
		imgBoss = imgFairy_Red;
		
		//Ctݒ
		SetLife( 1500 );
		
		//蔻ݒ
		SetCollisionEx( 32, 16, false, 180 );
		
		//C^XNJn
		TMain();
	}
	
	@MainLoop{
		//yield[v
		yield;
	}
	
	@DrawLoop{
		//d摜`
		DrawFairy( imgBoss );
	}
	
	@Finalize{
		//̒eACeɕς
		DeleteEnemyShotToItem( CHILD );
		
		//ŏI
		FinalizeData();
		
		//{ACe
		CreateUserItem( GetX(), GetY(), UI_BOMB );
	}
	
	/**
	 * C^XN
	 */
	task TMain(){
		//40F(0.66b)҂
		FWait( 40 );
		
		//~
		SetSpeed( 0 );
		ColorConcentration( 120, 255, 255, 255 );
		PlaySE( seCharge );
		FWait( 120 );
		
		//U
		alternative( difficult )
			case( "Easy" ){
				Atack_Easy();
			}
			case( "Normal" ){
				Atack_Normal();
			}
			case( "Panic" ){
				Atack_Panic();
			}
		
		FWait( 180 + 600 );
		
		//G
		VanishEnemy();
	}
	
	/**
	 * Easy UC^XN
	 */
	task Atack_Easy(){
	}
	
	/**
	 * Normal UC^XN
	 */
	task Atack_Normal(){
	}
	
	/**
	 * Panic UC^XN
	 */
	task Atack_Panic(){
		Atack1();
		FWait( 180 );
		
		Atack2();
	}
	
	/**
	 * e^XN1
	 */
	task Atack1(){
		let speed = 5.2;
		let span = 2;
		let roll = 22;
		let angle = 180;
		let way = 12;
		let leng = 24;
		let dangle = 120;
		let tangle = 0;
		
		loop{
			ascent( i in 0..way ){
				tangle = angle + i * 360 / way;
				CreateShot01( GetGapX( GetX(), leng, tangle ), GetGapY( GetY(), leng, tangle ), speed, angle         , US_BALL_F_PURPLE, 0 );
				CreateShot01( GetGapX( GetX(), leng, tangle ), GetGapY( GetY(), leng, tangle ), speed, angle - dangle, US_BALL_F_PURPLE, 0 );
			}
			
			angle += roll;
			
			FWait( span );
		}
	}
	
	/**
	 * e^XN2
	 */
	task Atack2(){
		let speed = 6.4;
		let span = 4;
		let roll = -24;
		let angle = 0;
		let way = 7;
		let dx = 0;
		let dy = 0;
		let leng = 24;
		
		loop{
			dx = -leng;
			dy = -leng;
			loop( way ){
				CreateShot01( GetX() + dx, GetY() + dy, speed, angle      , US_BALL_F_RED, 0 );
				CreateShot01( GetX() + dx, GetY() + dy, speed, angle - 180, US_BALL_F_RED, 0 );
				
				dx += leng * 2 / (way - 1);
				dy += leng * 2 / (way - 1);
			}
			
			dx =  leng;
			dy = -leng;
			loop( way ){
				CreateShot01( GetX() + dx, GetY() + dy, speed, angle      , US_BALL_F_RED, 0 );
				CreateShot01( GetX() + dx, GetY() + dy, speed, angle - 180, US_BALL_F_RED, 0 );
				
				dx -= leng * 2 / (way - 1);
				dy += leng * 2 / (way - 1);
			}
			
			angle += roll;
			
			FWait( span );
		}
	}
	
	//XNvg̃CN[h
	#include_function ".\..\..\initialize_zako.txt"
	
	#include_function ".\..\..\..\Library\lib_effect.txt"
}